package com.lsk.util;


/**
 * Created by Administrator on 2017/6/24.
 */
public class ReturnData {
    private String msg;
    private Object data;
    private String code;
    private String Time=DateUtil.getSdfTimes();
    private boolean result;


    public ReturnData(){


    }

    /**
     * 构造函数
     * @param b
     */
    public ReturnData(boolean b){
        if (b){
            this.code="000000";
            this.msg="操作成功";
            this.result=b;
        }else {
            this.code="111111";
            this.msg="操作失败";
            this.result=b;
        }

    }


    public boolean isResult() {
        return result;
    }

    public void setResult(boolean result) {
        this.result = result;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        if (this.data==null){
            data="";
        }else {

        }
        if (this.result){
            this.msg="操作成功";
        }else {

        }
        return data;
    }

    public void setData(Object data) {
        if (data == null){
            this.data="";
        }else {
            this.data = data;
        }
    }

    public String getCode() {
        if (this.result){
            this.code="000000";
        }else if (this.result=false){
            this.code="111111";
        }else {

        }
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getTime() {
        return Time;
    }

    public void setTime(String time) {
        Time = time;
    }

    public static ReturnData success() {
        return new ReturnData(true);
    }

    public static ReturnData fail(String msg) {
        ReturnData returnData = new ReturnData(false);
        returnData.setMsg(msg);
        return returnData;
    }
}
